# -*-coding:utf-8-*-

import time

def getTimeNow():
    return time.strftime("%H:%M:%S")

def getTimestamp():
    return int(round(time.time() * 1000))

def md5(str):
    import hashlib
    m = hashlib.md5()
    m.update(str)
    return m.hexdigest()

def byteCheck(data,byteNum):
    data1 = data.replace("0x","").replace(" ","")
    if len(data1) < (byteNum*2):
        data1 = "0"*(byteNum*2 - len(data1))+data1
    return data1

def imeiAssemble(userCodeString):
    codeArray = []
    userCode = ""
    for i in range(len(userCodeString)):
        codeArray.append(str(ord(userCodeString[i])))
    codeString = ''.join(codeArray)
    if len(codeString) < 15:
        userCode = codeString + "0"*(15-len(codeString))
    else:
        userCode = codeString[-15:]
    return userCode

